package com.ityedao.Collection集合遍历的方式.案例;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionTest {
    public static void main(String[] args) {
        /**
         * 需求:
         * 某影院系统需要在后台存储上述三部电影，然后依次展示出来。
         */
        Collection<Movie> movies = new ArrayList<>();
        movies.add(new Movie("《肖申克的救赎》", 9.9, "罗宾斯"));
        movies.add(new Movie("《霸王别姬》", 9.6, "张国荣"));
        movies.add(new Movie("阿甘正传", 8.9, "汤姆汉克斯"));

        for (Movie movie : movies) {
            System.out.println("电影名称：" + movie.getName());
            System.out.println("电影评分：" + movie.getScore());
            System.out.println("该片主演：" + movie.getActor());
            System.out.println("----------------------");
        }
    }
}
